package com.example.assetmanagement.mapper;

import com.example.assetmanagement.domain.Maintenance;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface MaintenanceMapper {

    List<Maintenance> selectPage(@Param("offset") int offset,
                                 @Param("limit") int limit,
                                 @Param("assetId") Long assetId,
                                 @Param("assetName") String assetName,
                                 @Param("status") Integer status,
                                 @Param("type") String type,
                                 @Param("priority") Integer priority,
                                 @Param("startDate") String startDate,
                                 @Param("endDate") String endDate);

    long count(@Param("assetId") Long assetId,
               @Param("assetName") String assetName,
               @Param("status") Integer status,
               @Param("type") String type,
               @Param("priority") Integer priority,
               @Param("startDate") String startDate,
               @Param("endDate") String endDate);

    Maintenance selectById(@Param("id") Long id);

    int insert(Maintenance maintenance);

    int update(Maintenance maintenance);

    int deleteById(@Param("id") Long id);

    int deleteBatch(@Param("ids") List<Long> ids);

    int updateStatus(@Param("id") Long id, @Param("status") Integer status);

    List<Maintenance> selectByAssetId(@Param("assetId") Long assetId);

    Map<String, Object> stats();
} 